Skip to content

Allow removal and adding for plugins in iconMenu - #861

Open
oeninghe-dataport wants to merge 19 commits into
nextfrom
fix/668-iconMenu-plugin-removal
Open

Allow removal and adding for plugins in iconMenu#861
oeninghe-dataport wants to merge 19 commits into
nextfrom
fix/668-iconMenu-plugin-removal

Conversation

@oeninghe-dataport

Copy link
Copy Markdown
Collaborator

Summary

Plugins in iconMenu can be added and removed at runtime.

Note:
coreStore.removePlugin(...) is still not supported for plugins within iconMenu. I deem this correct. As iconMenu adds the plugin, it should also be responsible for removal of the plugin. Otherwise, we'd need to breach the separation of core and plugins.

Instructions for local reproduction and review

  • Open snowbox.
  • Add the layer "Anliegen (MML)"
  • Open filter plugin.
  • Filter out some "Anliegen".
  • Press the newly-introduced "Add/Remove filter plugin" button.

Relevant tickets, issues, et cetera

Fixes #668

@oeninghe-dataport oeninghe-dataport added this to the POLAR@3 milestone Jul 6, 2026
@oeninghe-dataport oeninghe-dataport self-assigned this Jul 6, 2026
@oeninghe-dataport
oeninghe-dataport requested a review from a team July 6, 2026 08:38
@oeninghe-dataport oeninghe-dataport added the bug Something isn't working label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Dataport.github.io/polar/pr-preview/pr-861/

Built to branch gh-pages at 2026-08-04 12:46 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@dopenguin dopenguin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/plugins/filter/store.ts
Comment thread src/plugins/iconMenu/store.ts Outdated
Comment thread src/plugins/iconMenu/store.ts Outdated
Comment thread src/plugins/iconMenu/store.ts Outdated
@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin

Copy link
Copy Markdown
Member

🏓 @dopenguin

🏓 @oeninghe-dataport

@oeninghe-dataport
oeninghe-dataport force-pushed the next branch 2 times, most recently from a353df3 to 6a19ea0 Compare July 17, 2026 08:49
As decided in a not-yet-published architectural decision, we usually do
not want to use watchers, but explicit mutations instead :-(
As decided in a not-yet-published architectural decision, we usually do
not want to use watchers, but explicit mutations instead :-(
@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin dopenguin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a lot of actions seem to fire when removing the plugin 🤨

Image

🏓 @oeninghe-dataport

Comment thread src/lib/watchArray.ts Outdated
Comment thread src/plugins/iconMenu/components/NineRegionsButton.ce.vue Outdated
Comment thread src/plugins/iconMenu/components/StandardMenuList.ce.vue Outdated
Comment thread src/plugins/iconMenu/store.ts
Comment thread src/plugins/iconMenu/store.ts
Comment thread src/plugins/iconMenu/store.ts
Comment thread src/plugins/iconMenu/store.ts
Comment thread src/plugins/iconMenu/store.ts
Comment thread src/plugins/iconMenu/store.ts Outdated
Comment on lines +43 to +46
function isPluginInIconMenu(pluginId: string) {
const display = coreStore.configuration[pluginId]?.displayComponent
return typeof display === 'boolean' ? display : true
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to the intention of this PR thus 🎩, but I realized that this never did anything if the configuration was directly added to the plugin. If you see a quick solution, add it here, otherwise, I'll make a note for myself.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not get why this check is necessary at all. I kept it here to prohibit regression, but in what scenario I'd add a plugin to the iconMenu (not standalone) but then do not display it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if you agree, I'll remove this check

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly thought that both layoutTag and displayComponent both don't do anything for plugins added to the iconMenu. Please add this to our next meeting agenda so we can think about dropping this.
Most clients already handle the use case this would tackle by simply not adding them then.

oeninghe-dataport and others added 4 commits August 3, 2026 13:00
Co-authored-by: Pascal Röhling <73653210+dopenguin@users.noreply.github.com>
Co-authored-by: Pascal Röhling <73653210+dopenguin@users.noreply.github.com>
oeninghe-dataport and others added 4 commits August 3, 2026 13:07
Co-authored-by: Pascal Röhling <73653210+dopenguin@users.noreply.github.com>
Co-authored-by: Pascal Röhling <73653210+dopenguin@users.noreply.github.com>
Co-authored-by: Pascal Röhling <73653210+dopenguin@users.noreply.github.com>
@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin

Copy link
Copy Markdown
Member

🏓 @dopenguin

Please take a look at the amount of actions mentioned in #861 (review)

🏓 @oeninghe-dataport

@oeninghe-dataport
oeninghe-dataport force-pushed the fix/668-iconMenu-plugin-removal branch from a77cdd7 to 7bbdec2 Compare August 4, 2026 12:44
@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

Please take a look at the amount of actions mentioned in #861 (review)

🏓 @oeninghe-dataport

The actions were there for several reasons. I reduced them a lot with 7bbdec2

@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin dopenguin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/core/stores/plugin.ts
Comment on lines +70 to +72
function getPluginStore<T extends BundledPluginId>(
id: T
): ReturnType<
T extends BundledPluginId
? BundledPluginStores<typeof id>
: PolarPluginStore
> | null {
): ReturnType<BundledPluginStores<T>> | null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't it the intention of the function to also be able to retrieve the store of custom plugins with this function?

Comment thread src/core/stores/plugin.ts

return {
plugins,
plugins: readonly(plugins) as readonly PluginContainer[],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as using a computed?

Comment on lines +76 to +78
if (pluginIndex !== -1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const pluginMenu = menus.value[pluginIndex]!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply moving pluginMenu outside the if-statement and then checking whether pluginMenu works even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugins added by IconMenu can not be removed with "removePlugin"

2 participants